﻿using System;

namespace __Able.Core.ConfigTable
{
    [Serializable]
    [AttributeUsage(AttributeTargets.Class)]
    public class ConfigTableAttribute : Attribute
    {
        public ConfigTableAttribute() { }
        public ConfigTableAttribute(int SystemType, string SystemId, string ConfigTableVersion)
        {
            this.SystemType = SystemType;
            this.SystemId = SystemId;
            this.ConfigTableVersion = ConfigTableVersion;
        }

        public int SystemType { get; set; }
        public string SystemId { get; set; }
        public string ConfigTableVersion { get; set; }

        public static ConfigTableAttribute Convert(Type type)
        {
            object[] o = type.GetCustomAttributes(typeof(ConfigTableAttribute), false);
            if (o.Length > 0)
                return o[0] as ConfigTableAttribute;
            return null;
        }
    }
}
